<html>
<?php
/**
 * Created by PhpStorm.
 * User: 利发
 * Date: 2015/6/13
 * Time: 14:15
 */
?>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>台风相似路径查询</title>

    <style type="text/css">
        <!--
        body {
            font-size: 15pt
        }

        td {
            font-size: 15pt
        }

        -->
    </style>

    <style type=text/css>
        body {
            background-image: url(back_real.jpg);
            background-repeat: no-repeat;
            background-position: center top;
        }
    </style>
</head>

<body>
<?php
if (!isset($_GET["num"])) {
    die("错误：未选择日期");
} else {
    $num_target_tf = $_GET["num"];
}
if (!isset($_GET["beg"])) {
    die("错误：未选择起始节点");
} else {
    $beg_target_tf = $_GET["beg"];
}

// ------基本设定------
$server = SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT;
$username = SAE_MYSQL_USER;
$password = SAE_MYSQL_PASS;
$database = SAE_MYSQL_DB;

$conn = mysql_connect($server, $username, $password);
if (!$conn) {
    die('无法连接数据库:' . mysql_error());
}

//存放目标台风记录点信息
$date_target_ty = array();
$hour_target_ty = array();
$lat_target_ty = array();
$lon_target_ty = array();
$no__target_ty = array();
$spe_target_ty = array();
$cot_target_ty = 0;

//存放目标台风的对比数据信息
$season_target_ty;


//选择数据库
mysql_select_db($database, $conn);
$query_target_tf = 'select * from typhoon_detail where num=' . $num_target_tf;
$result_target_ty = mysql_query($query_target_tf, $conn);
if (mysql_fetch_array($result_target_ty) == 0) {
    die('查无此台风数据，请重试');
}
while ($row = mysql_fetch_array($result_target_ty)) {
    //输出所有记录
//    for ($i = 0; $i < mysql_num_fields($result_target_ty); $i++) {
//        echo $row[$i] . ' ';
//    }
//    echo '<br />';

    //判断是否为对比起始记录点
    if ($row[9] >= $beg_target_tf && $row[9] < $beg_target_tf + 10) {
        //存放目标台风记录点信息
        $date_target_ty[$cot_target_ty] = $row[1];
        $hour_target_ty[$cot_target_ty] = $row[2];
        $lat_target_ty[$cot_target_ty] = $row[4];
        $lon_target_ty[$cot_target_ty] = $row[5];
        $no__target_ty[$cot_target_ty] = $row[9];
        $spe_target_ty[$cot_target_ty] = $row[10];
        echo $no__target_ty[$cot_target_ty] . ' ';
        $cot_target_ty++;
    }

}

mysql_close($conn);
?>

</body>
</html>